from __future__ import unicode_literals

from datetime import datetime

from django.db import models
from django.contrib.auth import get_user_model
from goods.models import Goods
User = get_user_model()
# Create your models here.
class UserFav(models.Model):
	"""
	用户收藏
	"""
	user = models.ForeignKey(User, verbose_name=u"用户")
	goods = models.ForeignKey(Goods, verbose_name=u"商品", help_text="商品id")
	add_time = models.DateTimeField(default=datetime.now, verbose_name="添加时间")

	class Meta:
		verbose_name = '用户收藏'
		verbose_name_plural = verbose_name
		unique_together = ("user", "goods")
	def __str__(self):
		return self.user.username
